package com.xbongbong.saas.script.tempenum;

import com.xbongbong.paas.enums.SerialDateEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 流水号初始化枚举
 *
 * @author feng.zheng
 * @version v1.0
 * @date 2019/1/18 10:23
 * @since v1.0
 */
@Getter
public enum SerialNumberEnum {
    //编号枚举
    CONTRACT_NO("SO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    ORDER_NO("OD.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    SALE_OPPORTUNITY_NO("OPP.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PURCHASE_NO("PUO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    RETURNED_PURCHASE_NO("RPO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    INSTOCK_NO("ISO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    QT_INSTOCK_NO("QTRK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PURCHASE_INSTOCK_NO("CGRK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    REFUND_INSTOCK_NO("XSTH.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PRODUCTION_INSTOCK_NO("SCRK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PRODUCTION_MATERIEL_NO("SCLL.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    RETURNED_MATERIEL_INSTOCK_NO("SCTL.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    OUTSTOCK_NO("OSO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    QT_OUTSTOCK_NO("QTCK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    WORK_ORDER_OUTSTOCK_NO("GDCK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    RETURNED_PURCHASE_OUTSTOCK_NO("CGTH.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    CONTRACT_OUTSTOCK_NO("XSCK.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    TRANSFER_NO("TO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    INVENTORY_NO("ITO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PAYMENT_NO("PMO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PAYMENT_SHEET_NO("RMO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PAY_PLAN_NO("PPO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PAY_PLAN_SHEET_NO("PSO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    ASSEMBLE_NO("ASO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    INVOICE_NO("IVO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PURCHASE_INVOICE_NO("PIO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    OTHER_INCOME_NO("OIO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    OTHER_EXPENSE_NO("OEO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    FUND_TRANSFER_NO("FTO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    REFUND_NO("RFO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    RETURN_NO("RTO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    WORKORDER_NO("WOO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    BOMBILL_NO("BOM.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    PRODUCTION_ORDER_NO("PRO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    WAREHOUSE_NO("WAO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    QUOTATION_NO("QU.", "_V", 1, SerialDateEnum.ALL.getValue(), 3),
    // 信用额度
    CREDIT_NO("CA.", "", 1, SerialDateEnum.NONE.getValue(), 7),
    CREDIT_FIXED_NO("FQ.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    CREDIT_TEMPORARY_NO("TQ.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    CREDIT_CARD_NO("CT.", "", 1, SerialDateEnum.ALL.getValue(), 4),
    // 产品编号的自增编号位数为6
    PRODUCT_NO("CP.","", 1, SerialDateEnum.ALL.getValue(), 6),
    // 期初库存单号
    ORI_STOCK_NO("QC.","", 1, SerialDateEnum.ALL.getValue(), 3),
    REIMBURSEMENT_FORM_NO("RFNO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    EXPENSE_NO("EXO.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    //回款计划前缀
    PAYMENT_TASK_NO("SCP.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    // 对账单
    CUSTOMER_STATEMENT_STATISTIC("SOA.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    // 成本调整单
    ADJUST_NO("CBTZ.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    // SLA日志
    SLA_LOG_NO("SLA.", "", 1, SerialDateEnum.ALL.getValue(), 6),
    // 回执单
    RECEIPT_ORDER_NO("HZ.", "", 1, SerialDateEnum.ALL.getValue(), 3),
    ;

    /**
     * 前缀
     */
    private String prefix;
    /**
     * 后缀
     */
    private String postfix;

    /**
     * 起始值
     */
    private Integer startNum;
    /**
     * 时间类型，可选项有无，年，年月，年月日，构成编号中的日期部分
     * NONE("none", "无"),
     * YEAR("year", "年"),
     * MONTH("month", "月"),
     * DAY("day", "日"),
     * ALL("all", "年月日");
     */
    private String dateFormat;
    /**
     * 自增编号位数
     */
    private int numberDigit;

    SerialNumberEnum(String prefix, String postfix, Integer startNum, String dateFormat, int numberDigit) {
        this.prefix = prefix;
        this.postfix = postfix;
        this.startNum = startNum;
        this.dateFormat = dateFormat;
        this.numberDigit = numberDigit;
    }

    /**
     * 获取所有流水号枚举
     *
     * @return java.util.List<com.xbongbong.saas.script.tempenum.SerialNumberEnum>
     * @author feng.zheng
     * @date 2019/1/18 14:48
     */
    public static List<SerialNumberEnum> getAllEnum() {
        List<SerialNumberEnum> list = new ArrayList<>();
        Collections.addAll(list, values());
        return list;
    }
}
